<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%company}}".
 *
 * @property string $id
 * @property string $company_name
 * @property string $url
 * @property double $sort
 * @property integer $is_display
 * @property string $created_at
 * @property string $updated_at
 */
class Company extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%company}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['company_name','company_name'], 'required'],
            [['company_name'], 'unique','message' =>'公司名称不能重复'],
            [['sort'], 'number'],
            [['is_display', 'created_at', 'updated_at'], 'integer'],
            [['company_name', 'url'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'company_name' => '公司名称',
            'url' => 'Url',
            'sort' => '排序',
            'is_display' => '是否显示',
            'created_at' => '创建时间',
            'updated_at' => '修改时间',
        ];
    }
}
